<form method="post" action="<?php echo site_url('welcome/register')?>">
	<input type="hidden" name="invite_id" value="<?php echo $id;?>">
	<p>用户名：<input type="text" name="name"><span class="a"></span></p>
	<p>密码：<input type="password" name="password"></p>
	<p><input type="submit" value="注册"class="b"></p>
</form>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>
<script>
$(function(){
	$("input[name='name']").blur(function(){
		var name=$(this).val();
		$.ajax({
			type:'post',
			url:'checks',
			data:{
				'name':name
			},
			success:function(res){
				if(res==1){
					$('.a').html("该用户已经被注册");
					$('.b').attr('disabled',true);
				}else{
					$('.a').html("");
					$('.b').attr('disabled',false);
				}
			}
		});
	});
});
</script>